#include <cv_bridge/cv_bridge.h>
#include <image_transport/image_transport.h>
#include <ros/ros.h>
#include "commons/rabbit_consts.h"
#include <opencv2/opencv.hpp>

void imageCallback(const sensor_msgs::ImageConstPtr& msg) {
  try {
    cv::imshow("after_test", cv_bridge::toCvShare(msg, "bgr8")->image);
  } catch (cv_bridge::Exception& e) {
    ROS_ERROR("Could not convert from '%s' to 'bgr8'.", msg->encoding.c_str());
  }
}

int main(int argc, char** argv) {
  ros::init(argc, argv, "after_test");
  ros::NodeHandle nh;
  cv::namedWindow("after_test");
  cv::startWindowThread();
  image_transport::ImageTransport it(nh);
  image_transport::Subscriber sub =
      it.subscribe(TOPIC_CAMERA_TWO, 1, imageCallback);
  ros::spin();
  cv::destroyWindow("after_test");
}
